package com.vercon.moensmart.popupwindow;

import android.content.Context;
import android.graphics.Color;
import android.view.View;

import com.vercon.moensmart.R;

import razerdp.basepopup.BasePopupWindow;


public class RemoveWiFiWindow extends BasePopupWindow {

    private OnRemoveListener mListener;

    public RemoveWiFiWindow(Context context) {
        super(context);
        bindView();
    }

    private void bindView( ) {
        setBackgroundColor(Color.TRANSPARENT);
        findViewById(R.id.tv_remove).setOnClickListener(v -> {
            if (mListener != null) {
                mListener.onRemove();
            }
            dismiss();
        });
    }

    public void show(View view) {
        setOffsetX(-(int) getContext().getResources().getDimension(com.vercon.common.R.dimen.dp_80));
        setOffsetY(-(int) getContext().getResources().getDimension(com.vercon.common.R.dimen.dp_110));
        showPopupWindow(view);
    }

    @Override
    public View onCreateContentView() {
        return createPopupById(R.layout.window_remove_wifi);
    }

    public void setOnRemoveListener(OnRemoveListener removeListener) {
        mListener = removeListener;
    }

    public interface OnRemoveListener {
        void onRemove();
    }
}